<template>
  <div class="main">
    <h2>main组件</h2>
    <el-button type="primary">
      <router-link tag="a" :to="{name: 'test', query:{ message: message} }" class="to">跳转到test</router-link>
    </el-button>
    <br />
    <child :msg="parentmsg" @aaa="aaa"></child>
    <p>子组件传递过来的值：{{data}}</p>
  </div>
</template>
<script>
import child from "./child";

export default {
  props: ["msg"],
  data() {
    return {
      message: "go back",
      parentmsg: "fatherData",
      data: ""
    };
  },
  methods: {
    aaa(data) {
      this.data = data;
      console.log(data);
    }
  },
  components: {
    child
  }
};
</script>
<style scoped>
.to {
  color: rgb(255, 255, 255);
}
</style>